layui.define(['layer','jquery','form','laydate'], function (exports) {
    var $ = layui.jquery;
    var layer=layui.layer;
    var laydate = layui.laydate;
    var form = layui.form();

    var index = parent.layer.getFrameIndex(window.name);
    //监听提交
    form.on('submit(formDemo)', function(data){
        //layer.msg(JSON.stringify(data.field));
        //验证通过-提交表单
        $.post("/html/repair/srv/repair_assign.php",$("#form1").serialize(),function(d){
            layer.msg(d);
            setTimeout("parent.layer.close(index)", 2000)
        })
    });
    
	var repair_type = $('#repair_type').val();
	/*查对应的维修人员*/
	$.ajax({
		datatype:'string',
		type:'post',
		data:{"repair_type":repair_type,"tpl":"get_repair_userlist"},
		url:'./srv/rdo.php',
		async:true,
		success:function(d){
			$("#repair_user").empty().html(d);
			form.render('select');
		}
	});

    form.on('checkbox(check)', function(data){
        if(data.elem.checked){
            $("input[name='checkbox']").prop("checked", true);
        }else{
            $("input[name='checkbox']").prop("checked", false);
        }  
        form.render('checkbox');      
    });



    
    exports('repair_assign', {});
});